<!doctype html>
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
	<head> 
		<meta charset="utf-8">
		<link rel="stylesheet" href="public/css/jquery-ui-1.8.16.custom.css">
		<script src="public/js/jquery.min.js"></script>
		<script src="public/js/jquery.bgiframe-2.1.2.js"></script>
		<script src="public/js/jquery.ui.core.js"></script>
		<script src="public/js/jquery.ui.widget.js"></script>
		<script src="public/js/jquery.ui.mouse.js"></script>
		<script src="public/js/jquery.ui.button.js"></script>
		<script src="public/js/jquery.ui.draggable.js"></script>
		<script src="public/js/jquery.ui.position.js"></script>
		<script src="public/js/jquery.ui.dialog.js"></script>
		<script src="public/js/jquery.ui.resizable.js"></script>
	
	<script type="text/javascript">
	//创建
	$.fx.speeds._default = 1000;
	$(function() {
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		var addcode = $( "#addcode" );
		allFields = $( [] ).add( addcode );
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 400,
			width: 600,
			modal: true,
			show: "blind",
			hide: "blind",
			buttons: {
				"修改": function() {
					
					allFields.removeClass( "ui-state-error" );
					var pid="<?php echo $content[0]->pid;?>";
					var type="<?php echo $content[0]->type;?>";
					
					$.post("index.php?c=pj&a=editcode",{pid:pid,type:type,codetext:addcode.val()});
					$( this ).dialog( "close" );
					location.replace(location.href);
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
		$( "#button" )
		.button()
		.click(function() {
			$( "#dialog-form" ).dialog( "open" );
		});
	});
	</script>
	</head>
	<body>
		<div id="dialog-form" title="修改">
			<p class="validateTips">修改提交代码</p>

			<form>
				<fieldset>
					<div>代码</div>
					<textarea cols=65 rows=18 id="addcode" class="text ui-widget-content ui-corner-all"><?php echo $content[0]->codetext; ?></textarea>
				</fieldset>
			</form>
		</div>		
		
		<button id="button">修改提交代码</button>
		<div>
			<div>代码类型：<?php echo $content[0]->type; ?></div>
			<div>代码如下：</div>
			<div><?php $p = str_replace(chr(10), "<br>", $content[0]->codetext);echo $p; ?></div>
		</div>
	</body>